package cn.net.autocode.platform.customDict.dict;

import cn.net.autocode.core.bean.ResultT;
import cn.net.autocode.dbManager.Dao;
import cn.net.autocode.platform.customDict.CustomDict;
import cn.net.autocode.platform.customDict.CustomDictAnnotation;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;


@CustomDictAnnotation("fkTable")
@Component("autocode_platform_fkTable")
public class FkTable implements CustomDict {
    private final Dao dictDao;

    public FkTable(@Qualifier("dictDao") Dao dictDao) {
        this.dictDao = dictDao;
    }

    @Override
    public ResultT query(JSONObject param) {
        JSONArray array = dictDao.queryJSONArray("select table_name value,table_name label from ac_table order by table_name");
        return ResultT.success(array);
    }
}
